<?php

class Core_Backend_Component_Resource_View_Account_Index extends Core_Backend_Share_View_Grid {

    protected function buildGrid($grid) {
        $grid->setId('account_grid')
                ->setPrimaryKey('id');
        $grid->addLabelColumn($this->__('resource.label.full_name'), 'full_name', '{full_name}');
        if($this->getIdentity()->isAllowAction('resource_account_assign_road')){
	        $grid->addLinkColumn('#', 'assign_road', $this->getUrl(array('accountid' => '{id}'), 'road-list'), $this->__('resource.button.assign_road'))
	                ->setWidth(80)
	                ->setAlign('center');
        }
        if($this->getIdentity()->isAllowAction('resource_account_assign_road')){
	        $grid->addLinkColumn('#', 'assign_industry', $this->getUrl(array('accountid' => '{id}'), 'industry-list'), $this->__('resource.button.assign_industry'))
	                ->setWidth(80)
	                ->setAlign('center');
        }
        if($this->getIdentity()->isAllowAction('resource_account_assign_poi')){
	        $grid->addLinkColumn('#', 'assign_poi', $this->getUrl(array('accountid' => '{id}'), 'poi-list'), $this->__('resource.button.assign_poi'))
	                ->setWidth(80)
	                ->setAlign('center');
        }
        $grid->setDataSource($this->getList()->toArray());
        parent::buildGrid($grid);
    }
}